<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/mainstyle.css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="./css/themes/base/jquery.ui.all.css">
	<script src="./js/jquery-1.6.2.min.js"></script>
    <link rel="stylesheet" href="./css/demos.css">
<title>呼叫线路监控</title>
</head>

<script>


//页码导航 
function post_list(index,curpage,maxpage)
{ 
     if ( parseInt(index) <= parseInt(maxpage) && parseInt(index) > 0  && parseInt(curpage)!=parseInt(index) )
	 {
        document.form1.action = '?action=call_list&curpage='+index+'&agent_id=<% $agent_id %>'; 
	    document.form1.submit(); 
	    return true;
	 }
	 return false;
}

function  change_acct_id(acct_id)
{
	    document.form1.submit(); 
	    return true;		 
	
}

	
    
 </script>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="24" bgcolor="#353c44"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                
                <td width="97%" valign="bottom"><span  align="left" class="table_caption">呼叫线路监控
                </span></td>
              </tr>
            </table></td>
            <td><div align="right"><span class="STYLE1"></span>
             
             
             
             </div></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
    
 <form name="form1" method="post" action="?action=call_list">

 
         <tr>
           <td  height="26" colspan="13"    bgcolor="#FFFFFF" class="STYLE6"><span class="STYLE1">代理
             <select name="agent_id" class="STYLE1" id="agent_id" onchange= "change_acct_id(this.value)"  >
                <option  value="" > --全部-- </option>
                <option  value="<% $res_acct.decode_id%>"  <% if $res_acct.decode_id eq $agent_id %> selected <%/if%>> <% $res_acct.acctname %> </option>
                  <%foreach from=$acctchild item=eachone key=keyname %>
                  <option  value="<% $eachone.decode_id %>" <% if $eachone.decode_id eq $agent_id %> selected="selected" <%/if%> >
                    <% $eachone.acctname %>
                  </option>
                  <%/foreach%>
                </select>
呼叫状态
<select name="state" class="STYLE1" id="state" >
  <option  value="-1"  > 全部 </option>
  <option  value="1" <% if $post_data.state eq '1' or   $post_data.state eq '2'  or   $post_data.state eq '3' or   $post_data.state eq '4'  or   $post_data.state eq '5'  or   $post_data.state eq '6'  %> selected <%/if%>  > 正在呼叫 </option>
  <option  value="0" <% if $post_data.state eq '0' %> selected <%/if%>  > 正在通话 </option>
</select>
<label for="acctname"> 用户帐号</label>
<input name="acctname" type="text" class="STYLE1" id="acctname" size="20" maxlength="30" value='<% $post_data.acctname %>' />
<label for="called"> 被叫号码</label>
<input name="called" type="text" class="STYLE1" id="called" size="20" maxlength="30" value='<% $post_data.called %>' />
<input name="querybtn" type="submit" class="STYLE1"   id="querybtn"  value=" 查询 " />
           </span></td>
         </tr>
          </form>
         <tr>
                          <td width="4%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">序号</div></td>
                          <td width="6%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">分销ID</div></td>
                          <td width="4%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">帐号</div></td>
                          <td width="10%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">中继名称</div></td>
                          <td width="10%"  height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">费率组</div></td>
                          <td width="6%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">主叫</div></td>
                          <td width="6%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">被叫</div></td>
                          <td width="8%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">业务</div></td>
                          <td width="4%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">状态</div></td>
                          <td width="8%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">开始</div></td>
                          <td width="4%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">应答</div></td>
                          <td width="4%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">时长(秒)</div></td>
                          <td width="4%" height="24"    bgcolor="d3eaef" class="STYLE6"><div align="center" class="table_title">选项</div></td>
                    
                          
        </tr>     

          
          
          <% foreach from=$table_array item=eachone key=keyname %>  	
        <tr>

              <td height="18" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.check_id %>  </div></td>
   
                      <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.agent_name %> </div></td>
                      <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.accountcode %> </div></td>
                     <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.trunkname %> </div></td>
                      <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.rategroupname %> </div></td>
                      <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.caller %> </div></td>
                      <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.called %> </div></td>
                     <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% if $eachone.calltype eq 1 %>预付费<%elseif $eachone.calltype eq 2 %>回拨回铃<%elseif $eachone.calltype eq 3 %>回拨呼叫<%elseif $eachone.calltype eq 4 %>预付费呼出
                      	<%elseif $eachone.calltype eq 5 %>发送传真<%elseif $eachone.calltype eq 6 %>外呼IVR<%elseif $eachone.calltype eq 7 %>外呼队列<%elseif $eachone.calltype eq 8 %>外呼语音<%else%>其他业务><%/if%> </div></td>
                     <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% if $eachone.state eq '0' %><font color="#3366FF">通话</font><%else%>呼叫<% $eachone.state  %><%/if%> </div></td>
                     <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.start_time %> </div></td>
                     <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.answer_time|date_format:"%T" %> </div></td>
                    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><% $eachone.timelong %> </div></td>
                    <td height="20" bgcolor="<% if $keyname is even %>#FFFFFF<%else%>#F3F3F3<%/if%>"><div align="center" class="STYLE19"><a href="#"  onClick="call_hangup('<%  $eachone.channel %>')" >挂断</a></div></td>
                
                       
           
              </tr>
          
 
        <% /foreach %>
    </table></td>
  </tr>
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left"><span class="STYLE21">共
              <% $record_count %>
              条记录，当前第
              <% $curpage %>
              /
              <% $maxpage %>
              页，每页
              <% $pagelimtcount %>
          条记录</span></div></td>
        <td width="67%"><table width="180" border="0" align="right" cellpadding="0" cellspacing="0">
          <tr>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('1',<% $curpage %>,'<% $maxpage %>')"  >首页</a> </div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $curpage-1 %>','<% $curpage %>','<% $maxpage %>')" >上一页</a></div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $curpage+1 %>','<% $curpage %>','<% $maxpage %>')" >下一页</a></div></td>
            <td width="40"><div align="center"> <a href="#" class="STYLE21" onClick="return post_list('<% $maxpage  %>' ,'<% $curpage %>','<% $maxpage %>')" >尾页</a></div></td>
           
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<script>
function call_hangup(channel) {
	 $.get("syslog.php?action=call_hangup",{res_channel:channel}, function(data){
		 if (data == '1')
		 {
		    alert('挂机任务已经发送成功');
		 }
		 else  alert('挂机任务已经发送失败');
	  });

	}
		
      
</script>
</body>

</html>
